package com.asj.house.controller;


import com.asj.house.entity.HouseRoom;
import com.asj.house.entity.HouseRoomDetail;
import com.asj.house.returns.RespEntity;
import com.asj.house.returns.RespTable;
import com.asj.house.service.HouseRoomDetailService;
import com.asj.house.vo.MapVO;
import com.asj.house.vo.param.RoomParam;
import io.swagger.annotations.Api;
import java.util.List;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 房源详情表 前端控制器
 * </p>
 *
 * @author asj
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/house-room-detail")
@Api(value = "房源详情接口", tags = "房源详情接口")
@Slf4j
public class HouseRoomDetailController {

    @Resource
    private HouseRoomDetailService houseRoomDetailService;

    @GetMapping("/list")
    @ApiOperation(value = "房源详细信息列表")
    public RespTable<List<HouseRoomDetail>> listHouseRoomDetail(RoomParam roomParam) {
        RespTable<List<HouseRoomDetail>> respTable = houseRoomDetailService.listHouseRoomDetail(roomParam);
        return respTable;
    }

    @PutMapping("/update")
    public RespEntity updateHouseRoomDetail(@RequestBody HouseRoomDetail houseRoomDetail) {
        RespEntity respEntity = houseRoomDetailService.updateHouseRoomDetail(houseRoomDetail);
        return respEntity;
    }

    @GetMapping("/chinaMap")
    @ApiOperation(value = "中国地图")
    public RespEntity<List<MapVO>> chinaMap() {
        RespEntity<List<MapVO>> respEntity = houseRoomDetailService.chinaMap();
        return respEntity;
    }

    @GetMapping("/provinceMap")
    @ApiOperation(value = "省份地图")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "province", value = "省份名称", required = true)
    })
    public RespEntity<List<MapVO>> provinceMap(@RequestParam(value = "province", required = true) String province) {
        RespEntity<List<MapVO>> respEntity = houseRoomDetailService.provinceMap(province);
        return respEntity;
    }


}
